<admintpl file="header"/>
<style type="text/css">
.col-auto { overflow: auto; _zoom: 1;_float: left;}
.col-right { float: right; width: 210px; overflow: hidden; margin-left: 6px; }
.table th, .table td {vertical-align: middle;}
.picList li{margin-bottom: 5px;}
</style>
</head>
<body class="J_scroll_fixed">
<div class="wrap J_check_wrap">
  <ul class="nav nav-tabs">
     <li><a href="{:U('AdminGongsi/index')}">所有</a></li>
     <li class="active"><a href="{:U('AdminGongsi/edit',array('term'=>empty($term['term_id'])?'':$term['term_id']))}"  target="_self">修改</a></li>
  </ul>
  <form name="myform" id="myform" action="{:u('AdminGongsi/edit_gongsi')}" method="post" class="form-horizontal J_ajaxForms" enctype="multipart/form-data">
    <div class="col-auto">
    <div class="table_full">
       <table class="table table-bordered ">
            <tr>
              <th width="80">栏目分类</th>
              <td>
				<select style="max-height: 100px;" name="item">
					{$taxonomys}
				</select>
				<div>
					
				</div>
              </td>
            </tr>
            <tr>
              <th width="80">公司名称</th>
              <td>
              	<input type="text" style="width:150px;" name="gname" id="title"  required value="{$post.gname}" style="color:" class="input input_hd J_title_color" placeholder="请输入联系人姓名" onkeyup="strlen_verify(this, 'title_len', 20)" />
              	<span class="must_red">*</span>
              </td>
            </tr>
            <tr>
              <th width="80">公司地址</th>
              <td><input type='text' name='address' id='keywords' required value='{$post.address}' style='width:300px'   class='input' placeholder='请输入地址'> </td>
            </tr>
             <tr>
              <th width="80">联系电话</th>
              <td><input type='text' name='gphone' id='source' required value='{$post.gphone}' style='width:100px'   class='input' placeholder='请输入手机号'></td>
            </tr>
            
            
            <tr>
          <th width="80">成立时间</th>
        
          <td><input type="text" name="createdate" id="updatetime" value="{$post.createdate|date='Y-m-d',###}" size="21" class="input length_3 J_datetime" style="width: 160px;"></td>
        </tr>
        <tr>
        <th width="80">服务项目</th>
        
          <td><input type='text' name='service' id='source'  value='{$post.service}' style='width:50%;height:100px;'   class='input' placeholder=''></td>
          
        </tr>
        <th width="80">QQ</th>
        
          <td><input type='text' name='qq' id='source'  value='{$post.qq}' style='width:100px'   class='input' placeholder=''>
          /微信<input type='text' name='weixin' id='source'  value='{$post.weixin}' style='width:100px'   class='input' placeholder=''></td>
        </tr>   
            <tr>
              <th width="80">乘车路线</th>
              <td>
              <input type='text' name='luxian' id='source' value='{$post.luxian}' class='input' placeholder='' />
              </td>
            </tr>             
            <tr>
              <th width="80">公司简历</th>
              <td><textarea name='resume' style='width:50%;height:100px;' placeholder=''>{$post.resume}</textarea></td>
            </tr>
           
            <tr>
              <th width="80">公司LOGO</th>
              <td>
              <div><input type='hidden' name='logo' id='thumb' value="{$post.logo}" />
			<a href='javascript:void(0);' onclick="flashupload('thumb_images', '附件上传','thumb',thumb_images,'1,jpg|jpeg|gif|png|bmp,1,,,1','','','');return false;">
			
			<if condition="empty($post['logo'])">
				<img src="__ROOT__/statics/images/icon/upload-pic.png" id='thumb_preview' width='135' height='113' style='cursor:hand' />
			<else/>
				<img src="{:sp_get_asset_upload_path($post['logo'])}" id='thumb_preview' width='135' height='113' style='cursor:hand' />
			</if>
			
			</a>
			
            <input type="button"  class="btn" onclick="$('#thumb_preview').attr('src','__ROOT__/statics/images/icon/upload-pic.png');$('#thumb').val('');return false;" value="取消图片">
            </div>
              </td>
            </tr> 
            <tr>
            <th width="80">审核状态 </th>
          <td>
          	<span class="switch_list cc">
			<label class="radio"><input type="radio" name="status" value="1" checked><span>已处理</span></label>
			<label class="radio"><input type="radio" name="status" value="0"  ><span>未处理</span></label>
		 	</span>
		 </td>
        </tr>   
        </tbody>
      </table>
    </div>
  </div>
  <div class="form-actions">
        <input type="hidden" name="id" value="{$post.id}" />        
        <button class="btn btn-primary btn_submit J_ajax_submit_btn" type="submit">提交</button>
        <a class="btn" href="{:U('AdminGongsi/index')}">返回</a>
  </div>
 </form>
</div>
<script type="text/javascript" src="__ROOT__/statics/js/common.js"></script>
<script type="text/javascript" src="__ROOT__/statics/js/content_addtop.js"></script>
<script type="text/javascript"> 
$(function () {
	//setInterval(function(){public_lock_renewal();}, 10000);
	$(".J_ajax_close_btn").on('click', function (e) {
	    e.preventDefault();
	    Wind.use("artDialog", function () {
	        art.dialog({
	            id: "question",
	            icon: "question",
	            fixed: true,
	            lock: true,
	            background: "#CCCCCC",
	            opacity: 0,
	            content: "您确定需要关闭当前页面嘛？",
	            ok:function(){
					setCookie("refersh_time",1);
					window.close();
					return true;
				}
	        });
	    });
	});
	/////---------------------
	 Wind.use('validate', 'ajaxForm', 'artDialog', function () {
			//javascript
	        
	            //编辑器
	            editorcontent = new baidu.editor.ui.Editor();
	            editorcontent.render( 'content' );
	            try{editorcontent.sync();}catch(err){};
	            //增加编辑器验证规则
	            jQuery.validator.addMethod('editorcontent',function(){
	                try{editorcontent.sync();}catch(err){};
	                return editorcontent.hasContents();
	            });
	            var form = $('form.J_ajaxForms');
	        //ie处理placeholder提交问题
	        if ($.browser.msie) {
	            form.find('[placeholder]').each(function () {
	                var input = $(this);
	                if (input.val() == input.attr('placeholder')) {
	                    input.val('');
	                }
	            });
	        }
	        //表单验证开始
	        form.validate({
				//是否在获取焦点时验证
				onfocusout:false,
				//是否在敲击键盘时验证
				onkeyup:false,
				//当鼠标掉级时验证
				onclick: false,
	            //验证错误
	            showErrors: function (errorMap, errorArr) {
					//errorMap {'name':'错误信息'}
					//errorArr [{'message':'错误信息',element:({})}]
					try{
						$(errorArr[0].element).focus();
						art.dialog({
							id:'error',
							icon: 'error',
							lock: true,
							fixed: true,
							background:"#CCCCCC",
							opacity:0,
							content: errorArr[0].message,
							cancelVal: '确定',
							cancel: function(){
								$(errorArr[0].element).focus();
							}
						});
					}catch(err){
					}
	            },
	            //验证规则
                rules: {
                    'cname':{required:1},                    
                    'address':{required:1},
                    'phone':{required:1},                    
                    },
	            
	            //验证未通过提示消息
                messages: {
                    'cname':{required:'请输入姓名'},                    
                    'phone':{required:'手机号不能为空'},
                    'address':{required:'家庭住址不能为空'},
                    
                    },
	            
	            //给未通过验证的元素加效果,闪烁等
	            highlight: true,
	            //是否在获取焦点时验证
	            onfocusout: false,
	            //验证通过，提交表单
	            submitHandler: function (forms) {
	                $(forms).ajaxSubmit({
	                    url: form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
	                    dataType: 'json',
	                    beforeSubmit: function (arr, $form, options) {
	                        
	                    },
	                    success: function (data, statusText, xhr, $form) {
	                        if(data.status){
								setCookie("refersh_time",1);
								//添加成功
								Wind.use("artDialog", function () {
								    art.dialog({
								        id: "succeed",
								        icon: "succeed",
								        fixed: true,
								        lock: true,
								        background: "#CCCCCC",
								        opacity: 0,
								        content: data.info,
										button:[
											{
												name: '继续添加？',
												callback:function(){
													reloadPage(window);
													return true;
												},
												focus: true
											},{
												name: '返回列表页',
												callback:function(){
													location='{:U('AdminGongsi/index')}';
													return true;
												}
											}
										]
								    });
								});
							}else{
								isalert(data.info);
							}
	                    }
	                });
	            }
	        });
	    });
	////-------------------------
});
</script>
</body>
</html>